window.onload=function(){		

/*-------------------------------轮播图start--------------------------------*/
var dot=document.getElementById("btn").getElementsByTagName("button");
var  x=document.getElementById("lunbo-inner");
	var  y=document.getElementsByClassName("lunbo-img");
	var  wid=$("#lunbo-img").width();
	var num=y.length-1;
	var lun=1; 
	
	/*下标button背景色*/
function see(index){
   for(var j=0;j<5;j++){
   if(dot[j].className == "on"){
   dot[j].className='off';
   break;
   }}
   dot[index].className="on";
   }  
  
   play();
      /*图片自动切换*/
function play(){	
		
	 timer=setInterval(function(){	    
		if(lun<num){
			x.style.transform="translate3d("+(-wid*lun)+"px, 0px, 0px)";
			x.style.transition="transform 1s ease 0s"; 
			see(lun);
		lun++;
		}else if(lun==num){
			x.style.transform="translate3d("+(-wid*lun)+"px, 0px, 0px)";
			x.style.transition="transform 1s ease 0s";
            see(0);	
            lun++;		   
		}
		else if(lun>num){
			x.style.transform="translate3d(0px, 0px, 0px)";
			x.style.transition="transform 0s ease 0s";			
			lun=1;
			see(0);
		}
	},16000);	
}



/*点击button切换图片*/
for(var s=0;s<num;s++){
dot[s].onclick=function(){	
	clearInterval(timer);
	var index=this.getAttribute("index")-1;
	 x.style.transform="translate3d("+(-wid*index)+"px, 0px, 0px)";
	x.style.transition="transform 1s ease 0s";
    see(index);
	lun =index;
	play();
}}


/*------------------------------------轮播图end------------------------------------------*/


/*-----------------*/
var hover=document.getElementsByClassName("wrap");
var two=document.getElementsByClassName("two");
for(var i=0;i<hover.length;i++){
hover[i].onmouseover=function(){
var j=this.getAttribute("index");
  two[j].style.transform="translateY(-190px)";
  two[j].style.transition="transform 0.8s ease";
  }
  hover[i].onmouseout=function(){
  var j=this.getAttribute("index");
  two[j].style.transform="translateY(0px)";
  two[j].style.transition="transform 0.8s ease";
  }
  }
  
  
  
	/*----------------------导航栏start----------------*/
	
	$("#menu").click(function(){
		$("#nav").toggle();
	})                 //移动端导航栏
	
$(".choose").click(function(){
	var nums=this.getAttribute("index");
		$("#nav").find("div[index="+nums+"]").toggle();
	
})
	var choose=document.getElementsByClassName("choose");
	var showindex=document.getElementsByClassName("up");
	var showindex=document.getElementById("nav").getElementsByTagName("div");
	
	for(var i=0;i<7;i++){
	choose[i].onmouseover=function(){		
		var nums=this.getAttribute("index");
		showindex[nums].style.display="block";
	}
	choose[6].onmouseover=function(){
		showindex[4].style.display="block";
	}
	
	choose[i].onmouseout=function(){		
		var nums=this.getAttribute("index");
			showindex[nums].style.display="none";
	}	
	choose[6].onmouseout=function(){
		showindex[4].style.display="none";
	}
	showindex[i].onmouseover=function(){
		this.style.display="block";
	}
	showindex[i].onmouseout=function(){
		this.style.display="none";
	}
	}
	


}

